package lainformacion;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import org.apache.commons.lang.builder.ToStringBuilder;

@MappedSuperclass
public abstract class Article implements Serializable {

	private static final long serialVersionUID = 1L;

	protected int id;
	protected String externalId;
	protected String title;
	protected String text;
	protected String url;

	public Article() {
		super();
	}

	public Article(int id) {
		super();
		this.id = id;
	}

	public Article(int id, String title, String text) {
		super();
		this.id = id;
		this.title = title;
		this.text = text;
	}

	@Transient
	public abstract int getId();

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "externalId", length = 25)
	public String getExternalId() {
		return externalId;
	}

	public void setExternalId(String externalId) {
		this.externalId = externalId;
	}

	@Column(name = "title")
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "text", length = 500)
	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

	@Column(name = "url")
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}
}